package com.iwhalecloud.bss.kite.cucc.service.attr.linkhandler;

import com.iwhalecloud.bss.kite.cucc.service.attr.handler.OneOffAgreementPriceAttrHandler;
import com.iwhalecloud.bss.kite.listener.handler.attr.annotation.AttrHandler;
import com.iwhalecloud.bss.kite.listener.handler.attr.impl.AbstractAttrLinkageHandler;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;
import com.iwhalecloud.bss.kite.service.attr.AttrData;
import org.springframework.stereotype.Service;

import java.util.Objects;

@Service
@AttrHandler(OneOffAgreementPriceAttrHandler.class)
public class OneOffAgreementPriceAttrLinkHandler extends AbstractAttrLinkageHandler<AttrData> {
    @Override
    public void handle(KiteAttr attr, KiteInst inst, AttrData data) {
        //预存款,值保持与包周期协议价一致
        KiteAttr preStoreAttr = inst.getAttr("200002747");
        if (Objects.nonNull(preStoreAttr)) {
            preStoreAttr.setValue(attr.getValue());
            preStoreAttr.setValueDesc(attr.getValue());
        }
    }

    @Override
    public void handleStyle(KiteAttr attr, KiteInst inst, AttrData data) {

    }
}
